/**
 * Created by FangShenglong at 2020/07/28
 */
import cacheKeys from '@/common/app/cacheKeys.js';

export default {
  /**
   * 登录成功后缓存用户相关信息
   * @param commit
   * @param param
   * @constructor
   */
  setUserInfo({
    commit
  }, param) {
    param = param || {};
    commit(cacheKeys.CACHE_USER_INFO, param);
  },

  /**
   * 清除用户信息，退出登录时清空该信息
   * @param commit
   * @param param
   */
  clearUserInfo({
    commit
  }) {
    commit(cacheKeys.CACHE_USER_TOKEN, null);
    commit(cacheKeys.CACHE_USER_INFO, null);
    commit(cacheKeys.CACHE_CODE_TIME, null);
  }
}
